<?php
    @session_start();
    include_once '../../Model/M_Rubro.php';
    
    include_once '../../Model/M_FormularioPorRol.php';
    $pagina = $_REQUEST['idPag'];
    $idUsuario = $_SESSION['id_usuario'];
    $fxr = new M_FormularioPorRol();
    $fxr->setidUsuario($idUsuario);
    $fxr->setId_Pagina($pagina);
    $listaPrivilegios = $fxr->searchVis_FormularioRol_Uno();
    $flag_nuevo = 0;
    $flag_modif = 0;
    $flag_elim = 0;
    for($i=0;$i<(count($listaPrivilegios));$i++)
    {
        if($listaPrivilegios[$i]['formulario']=='Registrar')
        {
            $flag_nuevo = 1;
        }
        if($listaPrivilegios[$i]['formulario']=='Modificar')
        {
            $flag_modif = 1;
        }
        if($listaPrivilegios[$i]['formulario']=='Eliminar')
        {
            $flag_elim = 1;
        }
    }
    
    $rol = new M_Rubro();
    $lista = $rol->searchRubro_All();
    
    
?>
<!DOCTYPE html>
<html>
    <head>
        <title>Carta</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        
        <script src="../media/js/jquery.js" type="text/javascript"></script>
        <script src="../media/js/jquery.dataTables.js" type="text/javascript"></script>
        
        <style type="text/css">
            @import "../media/css/demo_table_jui.css";
            @import "../media/themes/smoothness/jquery-ui-1.8.4.custom.css";
            @import "../css/formularios.css";
            @import "../css/mantenedores.css";
        </style>
        
        
        <script type="text/javascript" charset="utf-8">
            $(document).ready(function(){
                $('#datatables').dataTable({
                    "sPaginationType":"full_numbers",
                    "aaSorting":[[0, "asc"]],
                    "bJQueryUI":true,
                    "oLanguage": {
                        "sLengthMenu": "Mostrar _MENU_ Registros",
                        "sZeroRecords": "No se encontraron registros",
                        "sInfo": "Mostrando _START_ de _TOTAL_ registros",
                        "sInfoEmpty": "Showing 0 to 0 of 0 records",
                        "sInfoFiltered": "(Filtrado de _MAX_ registros totales)",
                        "sSearch": "Buscar:",
                        "oPaginate": {
                            "sFirst": "Primero", "sLast": "Último",  "sNext": "Siguiente", "sPrevious": "Anterior"
                        }
                    }
                });
            })
            
        </script>
        <script LANGUAGE="JavaScript">
            function confirmSubmit()
            {
                var agree = confirm("¿Desea realmente ELIMINAR este registro?");
                if (agree)
                    return true;
                else
                    return false;
            }
            // -->
            function efecto(tipo, i)
            {
            if(tipo==0)document.getElementById('pro'+i).style.backgroundColor='white';
            else document.getElementById('pro'+i).style.backgroundColor='orange';
            }
            

            
        </script>
        <style>
            *{
                font-family: arial;
                font-size: 12px;
            }
            .pro_nombre{
                padding: 2px;
                font-family: Garamond, serif;
line-height: 1em;
color: #ffffff;
font-weight:bold;
font-size: 20px;
text-shadow:0px 0px 0 rgb(216,216,216),1px 1px 0 rgb(187,187,187), 2px 2px 0 rgb(158,158,158),3px 3px 2px rgba(0,0,0,0.35),3px 3px 1px rgba(0,0,0,0.5),0px 0px 2px rgba(0,0,0,.2);

            }
            
            .pro_imagen{
                
                height: 150px; width: 190px;padding: 8px; background: white; border-radius: 25px 25px 25px 25px;
                box-shadow: 2px 2px 20px #000;
                -webkit-box-shadow: 2px 2px 20px #000;
                -moz-box-shadow: 2px 2px 20px #000;
            }
        </style>
    </head>
    <body style="background: #555;">
        
        <div style="background: white; height: 100; position: relative; width: 100;">
            <?php
                        if(count($lista)>0)
                        {
                            for($i=0;$i<(count($lista));$i++) {
                    ?>
                    
            <div style="text-align: center; float: left; margin-left: 40px; margin-top: 50px">                                
                                
                <div id="pro<?=$lista[$i]['id_rubro']?>" onmouseover="efecto(1, <?=$lista[$i]['id_rubro']?>);" onmouseout="efecto(0, <?=$lista[$i]['id_rubro']?>);" class="pro_imagen">
                    <label><a href="V_Carta_SubRubro.php?idPag=<?=$lista[$i]['id_rubro']?>"><img src="<?php echo '../images/Rubro/'.$lista[$i]['imagen'];?>" title="<?php echo($lista[$i]['nombre']); ?>" style="margin-top: 3px;"  width="180px" height="140px" alt="" style="cursor: pointer"/></a></label></div>
                <br/>
                <label  class="pro_nombre"><?php echo ($lista[$i]['nombre']);?></label>
            </div>
                            
                    <?php
                            }
                        }
                    ?>
        </div>              
    </body>
</html>